<?php /**
 * myDirectory
 * extends DirectoryIterator
 * *add method isExtension($extension)
 * @package classes
 * @author tuadmin
 * @copyright 2010
 * @version 1.0.1
 * @access public
 */
 class myDirectory extends DirectoryIterator { public function isExtension( $a,$b = true ) { if ( $this->isFile() ) { return $b ? $this->_ExtensionIsExact($this->getFilename(),$a) : $this->_ExtensionIsNotExact($this->getFilename(),$a); } return false; } protected function _ExtensionIsExact($c,$a) { $d = strlen( $a ); return substr( $c, -$d, $d ) == $a ? true : false; } protected function _ExtensionIsNotExact($c,$a) { $d = strlen( $a ); return strtolower(substr( $c, -$d, $d )) == strtolower($a) ? true : false; } } 